package leetcode.字符串;

public class Excel表列序号171 {
    public int titleToNumber(String columnTitle) {
        int sum = 0;
        for (int i = 0; i < columnTitle.length(); i++) {
            char c = columnTitle.charAt(i);
            sum = sum * 26 + ((int)c - 'A' + 1);
        }
        return sum;
    }
}
